package hubkic.net;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends Activity {
    
    private String countries[];
    private String shortcuts[];
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.main);
   
        countries = getResources().getStringArray(R.array.countries_array);
        shortcuts = getResources().getStringArray(R.array.shortcuts_array);
        
        ListView listView = (ListView)findViewById(R.id.list);
        
        listView.setAdapter(new ArrayAdapter<String>(getApplicationContext(), 
                android.R.layout.simple_list_item_1, shortcuts));
        
        listView.setOnItemClickListener(new OnItemClickListener() {
        
            public void onItemClick(AdapterView<?> arg0, View view, int position,
                    long id) {
                Toast.makeText(getApplicationContext(), 
                        countries[position], Toast.LENGTH_SHORT).show();
            }
        });
    }
}